Date and Place: Pompeu Fabra University, 4-6 April 2016
Instructors: Juan Galeano & Antonio López Gay
GIS stands for Geographical Information System
A GIS consists of:
Digital Data: the geographical information that you will view and analyse using computer hardware and software.
Computer Hardware: computers used for storing data, displaying graphics and processing data.
Computer Software: computer programs that run on the computer hardware and allow you to work with digital data. A software program that forms part of the GIS is called a GIS Application.
With a GIS application you can open digital maps on your computer, create new spatial information to add to a map, create printed maps customised to your needs and perform spatial analysis.
QGIS is a user friendly Open Source Geographic Information System (GIS) licensed under the GNU General Public License. QGIS is an official project of the Open Source Geospatial Foundation (OSGeo).
As information becomes increasingly spatially aware, there is no shortage of tools able to fulfill some or all commonly used GIS functions. Why should anyone be using QGIS over some other GIS software package?
Here are only some of the reasons:
It’s free: Installing and using the QGIS program costs you a grand total of zero money. No initial fee, no recurring fee, nothing.
It’s Open Source: If you need extra functionality in QGIS, you can do more than just hope it will be included in the next release. You can sponsor the development of a feature, or add it yourself if you are familiar with programming.
It’s constantly developing: Because anyone can add new features and improve on existing ones, QGIS never stagnates. The development of a new tool can happen as quickly as you need it to.
Extensive help and documentation is available: If you’re stuck with anything, you can turn to the extensive documentation, your fellow QGIS users, or even the developers.
Cross-platform: QGIS can be installed on MacOS, Windows and Linux.
QGIS can by can be downloaded from its web page: http://www.qgis.org/en/site/forusers/download.html
The shapefile format is a popular geospatial vector data format for geographic information system (GIS) software. A shapefile is composed by
Mandatory files
Other files
There are several institutions/organizations devoted to provide geographical information. This is a incomplete but useful list to start:
GLOBAL ADMINISTRATIVE AREAS, Boundaries without Limits: GADM is a spatial database of the location of the world’s administrative areas (or adminstrative boundaries) for use in GIS and similar software. Administrative areas in this database are countries and lower level subdivisions such as provinces, departments, bibhag, bundeslander, daerah istimewa, fivondronana, krong, landsvæðun, opstina, sous-préfectures, counties, and thana. GADM describes where these administrative areas are (the “spatial features”), and for each area it provides some attributes, such as the name and variant names.
EUROSTAT GEODATA: NUTS, European Countries: Administrative units / Statistical units / NUTS / Urban Audit / Countries / Census / Communes
CENTRO NACIONAL DE INFORMACIÓN GEOGRÁFICA: The Download Center is a website from the National Center for Geographic Information (CNIG) where free downloads of geographic data files generated by the National Geographic Institute (IGN) can be made. Provided this information is accessible in accordance with Orden FOM/2807/2015 , of December 18th (BOE dated December 26th, 2015), which establishes the policy for the public diffusion of geographic data generated by the Directorate General of the National Geographic Institute.
DIVA-GIS: DIVA-GIS is developed by Robert Hijmans. Previous versions were co-developed with Edwin Rojas, Mariana Cruz, Rachel O’Brien, and Israel Barrantes. Our objective is to develop a free, and simple but versatile GIS program, that is particularly useful for studying the distribution of biodiversity. Countries / Different administrative levels.
NOMECALLES, Comunidad de Madrid: Shapefiles Madrid (Autonomous Community, Municipalities, census tracts, others).
INSTITUTO DE ESTADÍSTICA Y CARTOGRAFÍA DE ANDALUCIA: (Autonomous Community, Municipalities, census tracts, others).
CARTOBCN: Shapefiles of the municipality of Barcelona (Districts / Neighborhoods / Census tracts).
INSTITUT GEOLOGIC i CARTOGRÀFIC DE CATALUNYA: Shapefiles of Catalonia (Comarques / Municipalities / Census tracts).
A spatial reference system (SRS) or coordinate reference system (CRS) is a coordinate-based local, regional or global system used to locate geographical entities.
The QGIS Browser is a panel in QGIS that lets you easily navigate in your filesystem and manage geodata. You can have access to common vector files (e.g., ESRI shapefiles or MapInfo files), databases (e.g., PostGIS, Oracle, SpatiaLite or MS SQL Spatial) and WMS/WFS connections. You can also view your GRASS data (to get the data into QGIS, see GRASS GIS Integration). ***
QGIS allows us to work with all kind of spatial data (vectors, raster images, spatialite, etc.). To read a shapefile into QGIS we
request to add a vector layer from the Layer tab,
look for the shapefile (ESP_adm2.shp in this case) and click the Open button:
NOTE: alternatively, we can simply look for the shapefile on the QGIS browser and dragged into the Desktop.
As we want to edit a layer (delete and move features) first we save a copy of the original shapefile.
QGIS allows us to save a layer in multiple spatial formats. To save a layer as an ESRI shapefile we
select the layer to save on Layer panel, click on the right buttom of the mouse and Save As.
Select ESRI Shapefile on the Format tab and
Browse to select the output files name and location. Ok
Data associated with the shapefile can be access from the Open Attribute table tab.
The Identify features tab allows us access data associated with each of the elements (polygons in this case) of the shapefile.
The Select features tab allows us to select features by area or by clicking on them.
In order to Delete, Move, re-draw ,etc. a feature from a layer, first we activate the Toogle Editing tab.
After turning on the editing mode, select the feature/s to delet and click on the delete (trash) tab. Or simply click the backspace key on your keyboard.
To duplicate a layer
select the layer to duplicate on Layer panel,
click on the right buttom of the mouse and Duplicate.
We have loaded a shapefile of Catalonia by census tracts in 2014. Within the attributes of the shapefile there are two columns (MUNICPI and PROV) by which we can aggregate census census tracts. So, we will create two new layers (and corresponding shapefiles): one of Catalonia by municipalities (947) and by provinces (4). In order to perform this task we
Click on the Vector tab and within the Geoprocessing tools select Dissolve.
Select an input vector layer (CAT_2014_SC in this case) and a Dissolve field (MUNICIPI).
Browse to select the output files name and location. Ok
Repeat the same operation but dissolving the layer of census tracts by provinces. Please, name your new layer and shapefile CAT_2014_PROV.
Now we split our new layer (CAT_2014_MUN) of Catalonia by municipalities into four shapefiles (1 for each catalan province). In order to perform this task we
Click on the Vector tab and within Data Management Tools select Split Vector Layer.
Browse to select the output folder. Ok
With QGIS is really easy to merge several shapefiles to one. In order to perfom this task:
Create a new folder with the shapefiles to merge,
Click on the Vector tab and within Data Management Tools select Merge Shapefiles to one.
Browse to select an input directory (Folder from step 1) and Browse to select the output files name and location. Ok.
If we need to know the area and perimiter of each polygon of a layer
Click on the Vector tab and within Geometry Tools select Export/Add Geometry Columns.
Check the Save to new shapefile box and
Browse to select the output files name and location. Ok.
If we need some computation between extisting variables
Open the Attribute Table
Turn on the editing mode,
Opent the Field Calculator
Name the new variable
Select the field type and length
Recall: .dbf: attribute format; columnar attributes for each shape, in dBase IV format.
The easiest way to create a .dbf file is to download and install Open Office, read a .csv into the OpenOffice Calc and save it as a .dbf file.
The most common situation is not to found a shapefile with the data we want to represent on its .dbf file. So let’s see how to read a *csv file into QGIS and Join data to shapefile.
To read a csv into QGIS we
request to add Delimited Text Layer from the Layer tab,
look for the csv (DATOS_CAT_2014.csv in this case)
check the No Geometry (attribute only table) checkbox. Ok
NOTE: alternatively, we can simply look for the .csv file on the QGIS browser and dragged into the Desktop.
In order to join data to a layer,
Double-click on the shape layer on the Layer Panel and open the Layer Properties dialogue box
On the Joins tab add using the + symbol,
Assign a Join Layer (you data, .csv file)
Assign Join and Target field and
Choose which fields are joined. Ok
Greate a choropleth map
A choropleth map is a thematic map in which areas are shaded or patterned in proportion to the measurement of the statistical variable being displayed on the map, such as population density or per-capita income (4).
Recall previous exercises to perfom steps 1, 2 and 3.
Double-click on the shape layer on the Layer Panel and open the Layer Properties dialogue box
Select Graduated
Select the PROPEXT column,
Change the color ramp to oranges,
On Mode select Pretty Breaks and click on Classify
Click on symbol, Simple fill and set the board width to 0.160000,
Apply and Ok.
It seems you have a first map!!! Congrats!!!!
The Print Composer With the Print Composer (5) you can create nice maps and atlasses that can be printed or saved as PDF-file, an image or an SVG-file. This is a powerfull way to share geographical information produced with QGIS that can be included in reports or published.
The Print Composer provides growing layout and printing capabilities. It allows you to add elements such as the QGIS map canvas, text labels, images, legends, scale bars, basic shapes, arrows, attribute tables and HTML frames. You can size, group, align, position and rotate each element and adjust the properties to create your layout. The layout can be printed or exported to image formats, PostScript, PDF or to SVG (export to SVG is not working properly with some recent Qt4 versions; you should try and check individually on your system). You can save the layout as a template and load it again in another session. Finally, generating several maps based on a template can be done through the atlas generator.
On the Item properties tab go to Legend items,
Un-check the Auto Update,
Edit the legend by items.
On the Composition tab go to Export settings,
Set resolution on 300 dpi.
Recall previous exercises to perfom steps 1, 2, 3 and 4.